package cn.xxxy.fourm.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.xxxy.fourm.dao.BoardStateDao;
import cn.xxxy.fourm.entity.BoardState;
import cn.xxxy.fourm.model.BoardStateDto;
import cn.xxxy.fourm.service.BoardStateService;
import cn.xxxy.fourm.service.UserStateService;
@Service@Transactional
public class BoardStateServiceImpl implements BoardStateService{
	@Autowired
	private BoardStateDao boardStateDao;
	@Override
	public List<BoardStateDto> listBoardStates() {
		List<BoardState> lists=boardStateDao.findAll();
		List<BoardStateDto> lists1=new ArrayList<>();
		for (BoardState boardState : lists) {
			BoardStateDto boardStateDto=new BoardStateDto();
			boardStateDto.setId(boardState.getId());
			boardStateDto.setText(boardState.getBname());
			if(boardState.getId()==1) {
				boardStateDto.setSelected(true);
			}else {
				boardStateDto.setSelected(false);
			}
			lists1.add(boardStateDto);
		}
		return lists1;
	}

}
